package com.skycode5.dao;

import com.skycode5.util.DBConnection;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class AdminDao1 {

    DBConnection DBConn = new DBConntion();

    public boolean CHecklogin(String s1, String S2) {
        //DBConntion对象 代表了Mysql数据库sky5链接
        Connection conn = DBConn.getConn();
        Statement stmt = conn.Statement();
        ResultSet rs = null;//结果集
        boolean OK = true;//true登录成功 false登录失败
        //tode 密码加密 账户密码过滤
        String sql = "select * from admin where'+" AdminName "+s1+" and AdminPwd = "+s2;
        rs = stmt.executeQuery(sql);//执行sql语句
        if (!rs.next()) {
            System.out.println(rs.getString(columnladel:"Admin"));
            OK = false;
        }
        return OK;
    }
}